﻿@using System.Data;
@using System.Web;
@using DTcms.Web.MVC.Areas.Web.Controllers;
@using DTcms.Web.MVC.UI.Controllers;
@using DTcms.Model;
@{
   Layout = "~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/_LayoutShow.cshtml";
   DTcms.Model.channel_site site = ViewData["site"] as DTcms.Model.channel_site;
   DTcms.Model.siteconfig config = ViewData["config"] as DTcms.Model.siteconfig;
   DTcms.Model.article m = ViewData["model"] as DTcms.Model.article;
   BaseController bc = ViewBag.BasePage as BaseController;
   Article_ShowController c = ViewBag.This as Article_ShowController;
   string category_title = bc.get_category_title(m.category_id, "购物商城");
   ViewBag.Title = m.title + " - " + category_title +" - " + site.name;
   DataTable list = null;
   string channel = "goods";
}
@section HeaderContent{
@if(m.is_msg == 1){
<script src="~/Scripts/jquery/jquery.form.min.js"></script>
}
<script src="~/Scripts/jquery/jquery.jqzoom.js"></script>
<script src="~/Areas/Web/Scripts/picture.js"></script>
<script src="~/Areas/Web/Scripts/cart.js"></script>

<script>
$(function(){
	//TAB切换
	tabs('#goodsTabs','click');
	//智能浮动层
	$("#tabHead").smartFloat();
});
</script>
}

<div class="section clearfix">
  <div class="main-wrap">
    <!--页面左边-->
    <div class="left941">
      <!--商品图片-->
      <div class="goods-pic">
        <!--幻灯片-->
        <div class="pic-box">
          <div class="pic-preview">
            <span class="jqzoom">
              <img />
            </span>
          </div>
          <!--缩略图-->
          <div class="pic-scroll">
            <a class="prev">&lt;</a>
            <a class="next">&gt;</a>
            <div class="items">
              <ul>
                @if(m.albums!=null){
                   foreach(DTcms.Model.article_albums modelt in m.albums){
                   <li><img bimg="@modelt.original_path" src="@modelt.thumb_path" onmousemove="preview(this);" /></li>
                   }
                }
              </ul>
            </div>
          </div>
          <!--缩略图-->
        </div>
        <!--/幻灯片-->
      </div>
      <!--/商品图片-->
      
      <!--商品信息-->
      <div class="goods-spec">
        <script type="text/javascript" src="@(config.webpath)tools/submit_ajax.ashx?action=view_article_click&id=@m.id&click=1&hide=1"></script>
        <h1>@m.title</h1>
        <p class="subtitle">@m.fields["sub_title"]</p>
        <div class="spec-box">
          <dl>
            <dt>货号</dt>
            <dd id="commodityGoodsNo">@m.fields["goods_no"]</dd>
          </dl>
          <dl>
            <dt>市场价</dt>
            <dd><s id="commodityMarketPrice">¥@m.fields["market_price"]</s></dd>
          </dl>
          <dl>
            <dt>销售价</dt>
            <dd><em id="commoditySellPrice" class="price">¥@m.fields["sell_price"]</em></dd>
          </dl>
        </div>
        
        <div class="spec-box line">
          <dl>
            <dt>购买数量</dt>
            <dd>
              <div class="stock-box">
                <input id="commodityArticleId" type="hidden" value="@m.id" />
                <input id="commodityGoodsId" type="hidden" value="0" />
                <input id="commoditySelectNum" type="text" maxlength="9" value="1" maxValue="@m.fields["stock_quantity"]" onkeydown="return checkNumber(event);">
                <a class="add" onclick="addCartNum(1);">+</a>
                <a class="remove" onclick="addCartNum(-1);">-</a>
              </div>
              <span class="stock-txt">
                库存<em id="commodityStockNum">@m.fields["stock_quantity"]</em>件
              </span>
            </dd>
          </dl>
          <dl>
            <dd>
              <div id="buyButton" class="btn-buy">
                <button class="buy" onclick="cartAdd(this,'@(config.webpath)',1,'@bc.linkurl("shopping")');">立即购买</button>
                <button class="add" onclick="cartAdd(this,'@(config.webpath)',0,'@bc.linkurl("cart")');">加入购物车</button>
              </div>
            </dd>
          </dl>
        </div>
         
        <div class="spec-box line">
          <dl>
            <dd>
              <!--分享-->
              @RenderPage("~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/partial_share_js.cshtml")
              <!--/分享-->
            </dd>
          </dl>
        </div>
      </div>
      <!--商品信息-->
      <div class="line20"></div>
      
      <!--商品介绍-->
      <div id="goodsTabs" class="goods-tab">
        <!--选项卡-->
        <div id="tabHead" class="tab-head">
          <ul>
            <li>
              <a class="selected" href="javascript:;">商品介绍</a>
            </li>
            <li>
              <a href="javascript:;">商品评论</a>
            </li>
          </ul>
        </div>
        <!--/选项卡-->
        
        <!--选项内容-->
        <div class="tab-content entry" style="display:block">
          @Html.Raw(m.content)
        </div>
        <div class="tab-content">
          <!--用户评论-->
          @if(m.is_msg==1){
            @RenderPage("~/Areas/Web/Views/" + ViewBag.TemplateSkin + "/web/Shared/partial_comment_box.cshtml")
          }
          <!--用户评论-->
        </div>
        <!--选项内容-->
      </div>
      <!--/商品介绍-->
    </div>
    <!--页面左边-->
    
    <!--页面右边-->
    <div class="left211">
      <div class="sidebar-box">
        <div class="line30"></div>
        <h3>推荐商品</h3>
        <div class="red-list">
          <ul>
            @{ 
            DataTable redPhoto = bc.get_article_list(channel, 0, 4, "status=0 and is_red=1");
            foreach(DataRow reddr in redPhoto.Rows){
            <li>
              <a title="@reddr["title"]" href="@bc.linkurl("goods_show",reddr["id"])">
                <div class="img-box">
                  <img src="@reddr["img_url"]" />
                </div>
                <span>@reddr["title"]</span>
              </a>
            </li>
            }
            }
          </ul>
        </div>
        <div class="line10"></div>
        <h3>人气排行</h3>
        <ul class="rank-list">
         @{ 
         DataTable hotGoods = bc.get_article_list(channel, 0, 10, "status=0", "click desc,id desc");
         int hotcount = 0;
         foreach(DataRow hotdr in hotGoods.Rows){
            hotcount ++;
            if(hotcount == 1){
               <li class="active">
               <span>@DateTime.Parse(hotdr["add_time"].ToString()).ToString("MM-dd")</span>
               <i class="num">@hotcount</i><a href="@bc.linkurl("goods_show",hotdr["id"])">@hotdr["title"]</a>
               </li>
            }else{
               <li>
               <span>@DateTime.Parse(hotdr["add_time"].ToString()).ToString("MM-dd")</span>
               <i class="num">@hotcount</i><a href="@bc.linkurl("goods_show",hotdr["id"])">@hotdr["title"]</a>
               </li>
            }
         }
         }
        </ul>
      </div>
    </div>
    <!--/页面右边-->
  
  </div>
</div>